export type GithubOwnersMatchApi = {
    total_count: number;
    incomplete_results: boolean;
    items: {
        login: string;
        id: number;
        node_id: string;
        avatar_url: string;
        gravatar_id: string;
        url: string;
        html_url: string;
        followers_url: string;
        following_url: string;
        gists_url: string;
        starred_url: string;
        subscriptions_url: string;
        organizations_url: string;
        repos_url: string;
        events_url: string;
        received_events_url: string;
        type: string;
        site_admin: boolean;
        score: number;
        text_matches: {
            object_url: string;
            object_type: string;
            property: string;
            fragment: string;
            matches: {
                text: string;
                indices: Array<number>;
            }[];
        }[];
    }[];
};

export type GithubOwnersMatchModel = {
    login: string;
    avatarUrl: string;
    htmlUrl: string;
};

export const normalizeGithubOwnersMatch = (from: GithubOwnersMatchApi): GithubOwnersMatchModel[] =>
    from.items.map((owner) => ({
        login: owner.login,
        avatarUrl: owner.avatar_url,
        htmlUrl: owner.html_url,
    }));
